package gamagora.game
{
	import Box2D.Dynamics.b2Body;
	
	import gamagora.box2d.OSPhysicCircle;
	import gamagora.box2d.OSPhysicData;
	import gamagora.box2d.OSPhysicSprite;
	import gamagora.game.utils.OSImages;
	
	public class OSWaterCircle extends OSPhysicCircle
	{		
		private var _needRemove:Boolean;
		
		public function OSWaterCircle(x:Number=0, y:Number=0, radius:Number=0)
		{
			super(x, y, radius, OSImages.BLOB);
			setData(OSPhysicData.WATER);
			_physic.bodyDef.fixedRotation = true;
			_physic.bodyDef.type = b2Body.b2_dynamicBody;
			_physic.bodyDef.linearDamping = 1.0;
			_physic.fixDef.friction = 1.0;
			_physic.fixDef.density = 1.0;
		}
		
		public override function onBeginContact(sprite:OSPhysicSprite):void
		{
			if(sprite.data.type == OSPhysicData.GROUND)
			{
				_needRemove = true;
			}
			else 
			{
				if(sprite.data.type == OSPhysicData.PLAYER)
				{
					_needRemove = true;
					//TODO Clean player
				}
			}
		}

		public function get needRemove():Boolean
		{
			return _needRemove;
		}

		public function set needRemove(value:Boolean):void
		{
			_needRemove = value;
		}

	}
}